# coding:utf-8
# @Author: Mercur1o
# @Software: PyCharm
# @File : exerc1.py
# @Time: 2024/2/27 10:33
import matplotlib.pyplot as plt
import numpy as np

# 定义太阳花的参数
num_petals = 32  # 花瓣的数量
theta = np.linspace(0, 2*np.pi, num_petals*2)
r = np.cos(num_petals*theta) + 2  # 花瓣的半径
center_radius = 0.5  # 中心圆的半径

# 构建太阳花图形
fig, ax = plt.subplots(figsize=(10, 10))
ax.plot(center_radius*np.cos(theta), center_radius*np.sin(theta), color='yellow', linewidth=3)  # 中心圆

for i in range(num_petals):
    ax.plot(r*np.cos(theta + i*np.pi/num_petals), r*np.sin(theta + i*np.pi/num_petals), color='orange')

# 添加标题和删除坐标轴
ax.set_title('Sunflower')
ax.axis('off')

# 显示图形
plt.show()
